package com.ocl.www.controller;

import com.ocl.www.domain.User;
import com.ocl.www.utils.ResourceBundleUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by Administrator on 2016/12/8.
 */
@RestController
@RequestMapping(value = "/swagger")
public class SwaggerController {

    @RequestMapping(value = "/ui")
    public ModelAndView index() {
        //System.out.println("swagger-ui.html");
        ModelAndView mav = new ModelAndView();

        try {
            SecurityUtils.getSubject().getPrincipals().asSet();
            mav.setViewName("redirect:/swagger-ui.html");
        }catch (NullPointerException e){
            mav.setViewName("redirect:"+ResourceBundleUtils.getProperty("project.page.host")+"/403.html");
        }
        return mav;
    }

}